package oracle_sql_option

import (
	"database/sql"
	"fmt"
	"log"
)

func Oracle_Option_FR_Chan(sql string, db *sql.DB, sqlwhere string, chan_int chan int) error {
	plsql := fmt.Sprintf(sql, sqlwhere)
	row, err := db.Query(plsql)
	if err != nil {
		return err
	}
	num := 1
	for row.Next() {
		var nda Orcl_FR
		if err = row.Scan(&nda.C流水号,
			&nda.C上级单位流水号,
			&nda.C确认级别,
			&nda.C组织机构代码,
			&nda.C详细名称,
			&nda.C法定代表人,
			&nda.C行政区划代码,
			&nda.C详细地址,
			&nda.C单位注册地址,
			&nda.C单位注册区划,
			&nda.C长途区号,
			&nda.C固定电话,
			&nda.C固话分机号,
			&nda.C移动电话,
			&nda.C传真号码,
			&nda.C传真分机号,
			&nda.C邮政编码,
			&nda.C电子邮箱,
			&nda.C网址,
			&nda.C主要业务活动1,
			&nda.C主要业务活动2,
			&nda.C主要业务活动3,
			&nda.C行业代码,
			&nda.C机关级别_工商,
			&nda.C机关级别_民政,
			&nda.C机关级别_编制,
			&nda.C机关级别_国税,
			&nda.C机关级别_地税,
			&nda.C机关级别_其他,
			&nda.C登记注册号_工商,
			&nda.C登记注册号_民政,
			&nda.C登记注册号_编制,
			&nda.C登记注册号_国税,
			&nda.C登记注册号_地税,
			&nda.C登记注册号_其他,
			&nda.C登记注册类型,
			&nda.C企业控股情况,
			&nda.C隶属关系,
			&nda.C开业年份,
			&nda.C开业月份,
			&nda.C企业营业状态,
			&nda.C执行会计制度类别,
			&nda.C执行06会计准则,
			&nda.C机构类型,
			&nda.C产业活动单位数,
			&nda.C农林牧渔业产业数,
			&nda.C工业产业数,
			&nda.C建筑业产业数,
			&nda.C批零业产业数,
			&nda.C住餐业产业数,
			&nda.C房地产业产业数,
			&nda.C其它产业数,
			&nda.C期末从业人数,
			&nda.C女性人数,
			&nda.C全年营业收入,
			&nda.C主营收入,
			&nda.C资产总计,
			&nda.C非企业支出合计,
			&nda.C年末资产,
			&nda.C建筑业资质等级,
			&nda.C房地产业资质等级,
			&nda.C物业管理资质等级,
			&nda.C企业集团情况,
			&nda.C集团母公司单位代码,
			&nda.C开发区代码,
			&nda.C零售业态,
			&nda.C住宿业星级,
			&nda.C工业年报,
			&nda.C工业定报,
			&nda.C工业抽样,
			&nda.C建筑业年报,
			&nda.C建筑业定报,
			&nda.C交通邮电业统计,
			&nda.C社会服务业统计,
			&nda.C服务业统计年报,
			&nda.C批零贸易业年报,
			&nda.C批零贸易业定报,
			&nda.C批零贸易业抽样,
			&nda.C已由总公司统计,
			&nda.C劳动统计年报,
			&nda.C劳动统计定报,
			&nda.C科技统计,
			&nda.C其他类别统计,
			&nda.C房地产业年报,
			&nda.C房地产业定报,
			&nda.C住宿餐饮业年报,
			&nda.C住宿餐饮业定报,
			&nda.C住宿餐饮业抽样,
			&nda.C企业景气调查年报,
			&nda.C企业景气调查定报,
			&nda.C报表选项,
			&nda.C实际负责人,
			&nda.C统计负责人,
			&nda.C填表人,
			&nda.C填表人电话,
			&nda.C填表日期,
			&nda.C审表人,
			&nda.C审表日期,
			&nda.C统计局代码,
			&nda.C入库日期,
			&nda.C最后修改日期,
			&nda.C状态,
			&nda.C专业标识,
			&nda.C是否被合并上报单位,
			&nda.C合并上报单位代码,
			&nda.C附加选项1,
			&nda.C附加选项2,
			&nda.C附加选项3,
			&nda.C附加选项4,
			&nda.C附加选项5,
			&nda.C附加选项6,
			&nda.C附加标记1,
			&nda.C附加标记2,
			&nda.C附加标记3,
			&nda.C附加标记4,
			&nda.C附加标记5,
			&nda.C附加标记6,
			&nda.C普查,
			&nda.C变更类别,
			&nda.C确认专业,
			&nda.C旧代码,
			&nda.C行业代码_11,
			&nda.C主要业务活动1_11,
			&nda.C是否高新企业,
			&nda.C批零营业面积,
			&nda.C批零经营形式,
			&nda.C住餐经营形式,
			&nda.C住餐营业面积,
			&nda.C填表人移动电话,
			&nda.C行政区划代码_旧,
			&nda.C单位注册区划_旧,
			&nda.C单位规模,
			&nda.C成本费用调查年报,
			&nda.C规上大中型工业年报,
			&nda.C劳务分包调查年报,
			&nda.C劳务分包调查定报,
			&nda.C批零重点单位年报,
			&nda.C住餐重点单位年报,
			&nda.C批零重点单位定报,
			&nda.C住餐重点单位定报,
			&nda.C剔除原因,
			&nda.C剔除原因描述,
			&nda.C规上工业重点耗能定报,
			&nda.C规上非工业重点耗能定报,
			&nda.C重点服务业年报,
			&nda.C重点服务业定报,
			&nda.C文化产业年报,
			&nda.C营业税金及附加,
			&nda.C主营业务税金及附加,
			&nda.C执行企业会计准则,
			&nda.C经普唯一标识码,
			&nda.C建筑物编码,
			&nda.C文化产业单位,
			&nda.C健康服务业单位,
			&nda.C养老服务业单位,
			&nda.C不诚信单位,
			&nda.C亿元项目投资单位,
			&nda.C经营战略性新兴产业产品,
			&nda.C战略性新兴产业产品收入,
			&nda.C版本,
			&nda.C视同法人,
			&nda.C社会信用代码,
			&nda.C集团母公司信用代码,
			&nda.C投资年报,
			&nda.C投资定报,
			&nda.C经营形式,
			&nda.CG公司类型,
			&nda.CG注册时间,
			&nda.CG经营范围,
			&nda.CG财务,
			&nda.CG财务固话,
			&nda.CG财务手机,
			&nda.CG法人固话,
			&nda.CG法人手机,
			&nda.CG异常名录,
			&nda.CG违法失信,
			&nda.CG注销日期,
			&nda.CG经营期限自,
			&nda.CG经营期限止,
			&nda.C规上调查单位标识,
			&nda.C规下调查单位标识,
			&nda.C规下样本确认级别,
			&nda.C数据来源标识_31,
			&nda.C固定资产投资项目_31,
			&nda.C投资及合作项目数_31,
			&nda.C实际总投资额_31,
			&nda.C工业企业占地面积_31,
			&nda.C工业企业房屋建筑面积_31,
			&nda.C工业企业生产地址_31,
			&nda.C工业企业生产地址区划代码_31,
			&nda.C工业投产时间年_31,
			&nda.C工业投产时间月_31,
			&nda.C机构类型_31,
			&nda.C隶属关系_31,
			&nda.C实收资本_31,
			&nda.C国家资本_31,
			&nda.C集体资本_31,
			&nda.C法人资本_31,
			&nda.C个人资本_31,
			&nda.C港澳台资本_31,
			&nda.C外商资本_31,
			&nda.C统计登记号_31,
			&nda.C主管单位代码_31,
			&nda.C工业开发区代码_31,
			&nda.C商业中心区代码_31,
			&nda.C现代农业园区代码_31,
			&nda.C统计登记_31,
			&nda.C专业报表级别_31,
			&nda.C工业抽样统计_31,
			&nda.C工业统计年报_31,
			&nda.C建筑统计年报_31,
			&nda.C贸易抽样统计_31,
			&nda.C贸易统计年报_31,
			&nda.C房地产统计年报_31,
			&nda.C物管房产中介_31,
			&nda.C交通邮电业统计_31,
			&nda.C金融业统计年报_31,
			&nda.C服务业统计年报_31,
			&nda.C投资建设项目_31,
			&nda.C能源统计年报_31,
			&nda.C劳动统计年报_31,
			&nda.C劳动抽样统计_31,
			&nda.C其他类别统计_31,
			&nda.C一套表单位_31,
			&nda.C专业反馈信息_31,
			&nda.C部门反馈注销_31,
			&nda.C部门反馈说明_31,
			&nda.C上海自用1_31,
			&nda.C上海自用2_31,
			&nda.C统计登记申报类型_31,
			&nda.C统计报表类别_31,
			&nda.C统计管理单位代码_31,
			&nda.C园区开发区代码_31,
			&nda.C投资方国别代码_31,
			&nda.C工业园区代码,
			&nda.C众创_45,
			&nda.C众包_45,
			&nda.C众扶_45,
			&nda.C众筹_45,
			&nda.C经度_45,
			&nda.C纬度_45,
			&nda.C认定级别_45,
			&nda.C认定方式_45,
			&nda.C附加标记7_45,
			&nda.C附加标记8_45,
			&nda.C附加标记9_45); err != nil {
			return err
		}
		if num%1000 == 0 {
			log.Println("||过滤数据：", num)
		}
		num++
	}
	if err := row.Err(); err != nil {
		return err
	}
	chan_int <- num
	TIME_COUNT.Done()
	return nil
}
